#!/bin/bash
set -e

rm -rf build

mkdir -p build/pk && cd "$_"
`git rev-parse --show-toplevel`/../riscv-pk/configure --host=riscv64-unknown-elf
make -j4
cd -

mkdir -p build/hello && cd "$_"
riscv64-unknown-elf-gcc -O2 -o hello `git rev-parse --show-toplevel`/ci-tests/hello.c
cd -

mv build/pk/pk .
mv build/hello/hello .

tar -cf spike-ci.tar pk hello

rm pk hello
